<?php TPL::output('global/header.tpl.htm'); ?>

<div class="bd pbd">
  <div class="contant_left topicHeader">
    <h2 class="c_title"><a href="topic/<?php echo $this->topic_info['topic_title']; ?>" class="fr return_index" >&lt;&lt; 返回该话题</a>话题详情</h2>
    <!--start right-->
    <div class="tommy_rightDiv">
      <?php TPL::output('topic/related_topics.tpl.htm'); ?>
      
      <div class="RightListDiv">
        <h3 class="h3">修改记录</h3>
        <ul class="c_record" id="topic_log">
        <?php if ($this->log_list) { ?>
        	<?php foreach ($this->log_list as $key => $val) { ?>
        	<li><span class="time"><?php echo $val['add_time']; ?></span><a href="javascript:;" onclick="amendantRecord((decodeURIComponent('<?php echo rawurlencode('<div style="padding: 15px;">' . $val['add_time'] . ': ' .$val['title']) . '</div>'; ?>')));"><?php echo $val['user_name']; ?></a></li>
        	<?php } ?>
        <?php } ?>
        </ul>
      </div>
      <div class="RightListDiv">
        <h3 class="h3">分享/邀请完善</h3>
        <p>分享该话题或邀请好友共同完善该话题</p>
         <a href="javascript:;" onClick="share_content('topic', <?php echo $this->topic_info['topic_id'];?>, 'weibo', SYSTEM_WEIBO_ENABLED);" class="an a3">微博</a> <a href="javascript:;" onClick="share_content('topic', <?php echo $this->topic_info['topic_id'];?>, 'mail', SYSTEM_WEIBO_ENABLED);" class="an a1">邮件</a> <a href="javascript:;" onClick="share_content('topic', <?php echo $this->topic_info['topic_id'];?>, 'letter', SYSTEM_WEIBO_ENABLED);" class="an a2">私信</a></div>
    </div>
    <!--end right-->
    <div class="topic_contents">
      
	  <div class="topic_h topic_img">
        <p class="topic_Imgleft" id="topic_pic" style="background:url(<?php if ($this->topic_info['topic_pic']){ ?><?php echo get_setting('upload_url') . '/topic/' . str_replace(AWS_APP::config()->get('image')->topic_thumbnail['min']['w'].'_'.AWS_APP::config()->get('image')->topic_thumbnail['min']['h'], AWS_APP::config()->get('image')->topic_thumbnail['max']['w'].'_'.AWS_APP::config()->get('image')->topic_thumbnail['max']['h'], $this->topic_info['topic_pic']);?><?php } else { ?><?php echo G_STATIC_URL; ?>/common/topic-max-img.jpg<?php } ?>)">
        	<?php if ($this->user_info['permission']['is_administortar'] OR $this->user_info['permission']['is_moderator'] OR ($this->topic_info['topic_lock'] == 0 && $this->user_info['permission']['edit_topic'])) { ?><a class="editorTxt" href="javascript:;" id="topic_pic_uploader">&nbsp;</a><?php } ?>
        </p>
        <div class="topic_summarize mouse_e_c"><h4><span  id="headliner_h4"><em rel="<?php echo $this->topic_info['topic_title']; ?>"><?php echo $this->topic_info['topic_title']; ?> </em><?php if ($this->topic_info['topic_lock']) { ?><img class="lock" alt="lock" title="此话题已锁定" src="<?php echo G_STATIC_URL; ?>/css/default/img/lock.png"/><?php } ?> <?php if ($this->user_info['permission']['is_administortar'] OR $this->user_info['permission']['is_moderator'] OR ($this->topic_info['topic_lock'] == 0 && $this->user_info['permission']['edit_topic'])) { ?><a class="editorTxt" href="javascript:;" title="标题编辑" onClick="Headliner(true,'topic_txtValue','headliner_h4');">编辑</a></span><span id="topic_txtValue" class="hide"><input type="text" value="" id="topic_txt" class="topic_txt"/><a href="javascript:;" onClick="Headliner(false,'topic_txtValue','headliner_h4');"  class="default_blue_but">确定</a></span><?php } ?></h4>
      <div class="p">
	  <?php if ($this->log_list) { ?>
      	<?php foreach ($this->log_list as $key => $val) { ?>
        	<?php echo $val['add_time']; ?>: <?php echo $val['title']; ?>
        <?php break; } ?>
      <?php } ?>
      </div></div> 
      </div> 
      <h5 class="h5">话题详述</h5>
      	<div class="topic_h mouse_e_x" id="topic_description">
	      	<?php echo nl2br($this->topic_info['topic_description']); ?>
	      	<?php if ($this->user_info['permission']['is_administortar'] OR $this->user_info['permission']['is_moderator'] OR ($this->topic_info['topic_lock'] == 0 && $this->user_info['permission']['edit_topic'])) { ?><a href="javascript:;" onclick="$('#topic_description').hide(); $('#topic_description_editor').show();" class="editorTxt"  title="内容编辑">编辑</a><?php } ?>
      	</div>
      	<?php if ($this->user_info['permission']['is_administortar'] OR $this->user_info['permission']['is_moderator'] OR ($this->topic_info['topic_lock'] == 0 && $this->user_info['permission']['edit_topic'])) { ?>
      	<div id="topic_description_editor" class="topic_h txt hide">
      		<form action="topic/ajax/modify_topic_desc/topic_id-<?php echo $this->topic_info['topic_id']; ?>" method="post" id="description_form">
      		<textarea name="topic_description" class="txtarea"><?php echo htmlspecialchars($this->topic_info['topic_description']); ?></textarea>
        	<p class="tr" style="padding-top:20px;"><a class="default_gray_but" href="javascript:;" onclick="$('#topic_description_editor').hide(); $('#topic_description').show();">取消</a> &nbsp; <a class="default_blue_but" href="javascript:;" onclick="ajax_post($('#description_form'));">确定</a></p>
        </div>
        <?php } ?>
    </div>
    <div class="clear"></div>
  </div>
</div>

<script type="text/javascript">
	var TOPIC_ID = '<?php echo $this->topic_info['topic_id']; ?>';	
	var SYSTEM_WEIBO_ENABLED;
	<?php if (get_setting('sina_weibo_enabled') == 'Y' OR get_setting('qq_t_enabled') == 'Y') { ?>
	SYSTEM_WEIBO_ENABLED = 'Y';
	<?php } ?>
</script>

<script src="<?php echo G_STATIC_URL; ?>/js/topic.js"></script>

<?php TPL::output('global/footer.tpl.htm'); ?>